package com.caseeye.service
import scala.annotation.target.beanSetter

import com.caseeye.base.BaseService
import org.springframework.stereotype.Component
import com.caseeye.repository.CaseMasterRepository
import javax.annotation.Resource
import org.springframework.beans.factory.annotation.Required
import scala.reflect.BeanProperty
import com.caseeye.model._
import java.util.{ List => JList }
import scala.collection.immutable.{ List => SList }
import java.util.ArrayList

@Component
class CaseService extends BaseService {

    implicit def sList2JList[T](sl : SList[T]) : JList[T] = {
        val jl = new ArrayList[T]
        sl.foreach(jl add)
        jl
    }

    @Resource
    @BeanProperty
    @Required
    var caseMasterRepository : CaseMasterRepository = null

    def getCaseList(projectId : Int) : List[CaseMaster] = {
        caseMasterRepository.findAll
    }
}